package com.example.demo.utils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class SqlUtils {
    public static String parse(List<String> codes) {
        StringBuilder sb = new StringBuilder();
        for (String code : codes) {
            sb.append("'").append(code).append("'").append(",");
        }
        sb.deleteCharAt(sb.length() - 1);
        return sb.toString();
    }

    /**
     * 字符串转为集合
     *
     * @param tmp 字符串
     * @param flag 根据某个字符分割
     * @return 集合
     */
    public static List<String> stringToList(String tmp, String flag) {
        String[] str = tmp.split(flag);
        return new ArrayList<>(Arrays.asList(str));
    }
}
